package com.yiqi.liebang.feature.mine.view;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;

import com.suozhang.framework.component.recyclerview.DividerItemDecoration;
import com.suozhang.framework.framework.AM;
import com.suozhang.framework.framework.BaseActivity;
import com.suozhang.framework.widget.EmptyTextView;
import com.yiqi.liebang.R;
import com.yiqi.liebang.entity.bo.UserCenterBo;
import com.yiqi.liebang.feature.mine.view.adapter.EducationAdapter;
import com.yiqi.liebang.feature.mine.view.adapter.EducationListAdapter;
import com.yiqi.liebang.feature.mine.view.adapter.WorkAdapter;
import com.yiqi.liebang.feature.mine.view.adapter.WorkListAdapter;

import butterknife.BindView;
import butterknife.ButterKnife;

public class EduWorkListActivity extends BaseActivity {


    @BindView(R.id.rv_jyjl)
    RecyclerView mRvJy;
    @BindView(R.id.rv_gzjl)
    RecyclerView mRvWork;
    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    UserCenterBo mData = null;

    @Override
    protected int attachLayoutRes() {
        return R.layout.activity_edu_work_list;
    }

    @Override
    protected void initInjector() {

    }

    @Override
    protected void initView() {
        initToolBar(mToolbar, "背景经历", true, true);
    }

    @Override
    protected void initData() {
        mData = (UserCenterBo) this.getIntent().getSerializableExtra("info");


        EmptyTextView emptyViewWork = new EmptyTextView(mRvWork);
        WorkListAdapter workAdapter = new WorkListAdapter(true);
        mRvWork.setLayoutManager(new LinearLayoutManager(this));
        mRvWork.addItemDecoration(new DividerItemDecoration(DividerItemDecoration.VERTICAL).setHeight(2));
        workAdapter.bindToRecyclerView(mRvWork);

        if (mData.getOccupationAuthentication() != null && mData.getOccupationAuthentication().size() > 0) {
            workAdapter.setNewData(mData.getOccupationAuthentication());
        } else {
            workAdapter.setEmptyView(emptyViewWork.getEmptyView("该用户暂无添加工作经历"));
            workAdapter.setNewData(null);
        }

        EmptyTextView emptyViewJy = new EmptyTextView(mRvJy);
        EducationListAdapter jyAdapter = new EducationListAdapter(false);
        mRvJy.setLayoutManager(new LinearLayoutManager(this));
        mRvJy.addItemDecoration(new DividerItemDecoration(DividerItemDecoration.VERTICAL).setHeight(3));
        jyAdapter.bindToRecyclerView(mRvJy);

        if (mData.getEducationAuthentication() != null && mData.getEducationAuthentication().size() > 0) {
            jyAdapter.setNewData(mData.getEducationAuthentication());
        } else {
            jyAdapter.setEmptyView(emptyViewJy.getEmptyView("该用户暂无添加教育经历"));
            jyAdapter.setNewData(null);
        }

    }

}
